package com.gui.controller;

import com.gui.DTO.QuestionDTO;
import com.gui.service.QuestionSerice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * QuestionController
 *
 * @author guigu
 * @QQ 1170258867
 * @date 2020/6/11
 * @description
 */
@Controller
public class QuestionController {

    @Autowired
    private QuestionSerice questionSerice;

    @RequestMapping("/question/{questionId}")
    public String toQuestion(@PathVariable("questionId") int id, Model model){
        QuestionDTO questionDTO = questionSerice.getQuestionDTO(id);
        model.addAttribute("questionDTO",questionDTO);
        return "question";
    }
}
